<template>
  <div id="relation">
    <div class="top">
      <div class="topLeft">{{ info.name }}</div>
      <div class="topRight" @click="tapVideo">查看全部 <i class="fa fa-angle-right"></i></div>
    </div>
    <div class="goodslis">
      <div class="lis" v-for="(item, index) in info.article" :key="index" @click="toArticle(item.id,item.is_audio)">
        <div class="image">
          <img :src="item.thumb ? item.thumb : 'https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png'" alt="" />
        </div>
        <div class="title">{{ item.title }}</div>
        <div class="categroyTitle" v-if="item.cate_name">{{ item.cate_name }}</div>
        <div class="pageView">
          <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images%2Frelation%402x.png" alt="" />
          <div class="num">{{ item.nums }}</div>
        </div>
      </div>
      <div class="lis" v-for="(item, index) in info.video" :key="index" @click="toVideo(item.id)">
        <div class="image">
          <img :src="item.thumb ? item.thumb : 'https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png'" alt="" />
        </div>
        <div class="title">{{ item.title }}</div>
        <div class="categroyTitle" v-if="item.cate_name">{{ item.cate_name }}</div>
        <div class="pageView">
          <img src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images%2Frelation%402x.png" alt="" />
          <div class="num">{{ item.nums }}</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: ["info"],
  data() {
    return {};
  },
  mounted() {},
  methods: {
    tapVideo() {
      this.$router.push(this.fun.getUrl("VideoList", {}));
    },
    toArticle(id,is_audio) {
      if(is_audio){
        this.$router.push(this.fun.getUrl("VoiceDetail", { article_id: id }));
      }else{
        this.$router.push(this.fun.getUrl("articleContent", { id: id,isgood:true }));
      }
    },
    toVideo(id) {
      this.$router.push(this.fun.getUrl("VideoDetail", {}, { vid: id }));
    }
  }
};
</script>
<style lang="scss" scoped>
#relation {
  padding: 0.88rem 0.63rem;
  box-sizing: border-box;
  background: #fff;
  border-radius: 0.31rem;
  margin: 0.3125rem;
  margin-bottom: 1rem;

  .goodslis {
    margin-top: 0.81rem;
    display: flex;
    justify-content: flex-start;
    overflow-x: scroll;

    .lis {
      width: 8.13rem;
      margin-right: 0.63rem;

      .image {
        width: 8.13rem;
        height: 8.13rem;
        border-radius: 0.31rem;

        img {
          width: 100%;
          height: 100%;
          object-fit: cover;
          border-radius: 0.31rem;
        }
      }

      .title {
        font-weight: bold;
        color: #2c2c2c;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-top: 0.63rem;
        text-align: left;
      }

      .categroyTitle {
        font-size: 0.63rem;
        color: #666;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-top: 0.63rem;
      }

      .pageView {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        margin-top: 0.69rem;

        img {
          width: 0.69rem;
          height: 0.47rem;
          margin: 0;
          margin-right: 0.28rem;
        }

        .num {
          font-weight: 400;
          color: #999;
          font-size: 0.63rem;
        }
      }
    }
  }

  .goodslis::-webkit-scrollbar {
    display: none; /* Chrome Safari */
  }

  .top {
    display: flex;
    justify-content: space-between;

    .topLeft {
      color: #5f5e5e;
      text-align: left;
      font-size: 0.94rem;
    }

    .topRight {
      display: flex;
      align-items: center;
      color: #ed0100;

      .fa-angle-right {
        font-size: 1.3rem;
        margin-left: 0.41rem;
      }
    }
  }
}
</style>